﻿using Microsoft.Extensions.DependencyInjection;
using StackExchange.Redis;

namespace Msung.Core.Caching
{
    public static class RedisCacheSetupExtensions
    {
        public static void AddRedisCache(this IServiceCollection services)
        {
            services.AddSingleton<IRedisOperationRepository, RedisOperationRepository>();
            services.AddSingleton(sp =>
            {
                return ConnectionMultiplexer.Connect(AppSetting.RedisOptions.ConnectionString);
            });
        }
    }
}
